﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using DTO;
using DAO;
namespace BUS
{
    public class SanBay_BUS
    {
        //Cac ham truy xuat du lieu
        public static List<SanBay_DTO> layDanhSachSanBay()
        {
            return SanBay_DAO.layDanhSachSanBay();
        }

        public static SanBay_DTO laySanBayTheoMaSanBay(String maSB)
        {
            return SanBay_DAO.laySanBayTheoMaSanBay(maSB);
        }

        public static SanBay_DTO laySanBayDiTheoMaCB(string MaCB)
        {
            return SanBay_DAO.laySanBayDiTheoMaCB(MaCB);
        }

        public static SanBay_DTO laySanBayDenTheoMaCB(string MaCB)
        {
            return SanBay_DAO.laySanBayDenTheoMaCB(MaCB);
        }

        public static int themSanBay(SanBay_DTO sanbay)  // them san bay
        {
           
            if (SanBay_DAO.kiemTraSanBayDaTonTai(sanbay.maSB) == true)
            {
                return 2;
            }

            if (SanBay_DAO.themSanBay(sanbay) == true)
                return 1;

            return 0;
        }
        public static bool suaSanBay(SanBay_DTO sanbay)   // sua san bay
        {
            return SanBay_DAO.suaSanBay(sanbay);
        }

        public static bool xoaSanBay(string MaSB)   // xoa san bay
        {
            return SanBay_DAO.xoaSanBay(MaSB);
        }

    }
}
